﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BOOKSTORE.DATA.Models
{
    public class LanguageManager
    {
        DatabaseContext db = new DatabaseContext();
        public List<Language> GetAll()
        {
            try
            {
                return db.BookstoreContext.Languages.ToList();
            }
            catch (Exception ex)
            {
                throw (new Exception("ProducManager_GetlanguageByID" + ex.ToString()));
            }
        }
        public Language GetLanguageByLanguageCode(string languageCode)
        {
            try
            {
                return db.BookstoreContext.Languages.Where(m => m.LanguageCode.Trim() == languageCode.Trim()).FirstOrDefault();
            }
            catch (Exception ex)
            {
                throw (new Exception("ProducManager_GetlanguageByID" +ex.ToString()));
            }

        }

        public void Delete(string languageCode)
        {
           
        }
    }
}
